package _19动态代理;

import _01iInetAddress类.Demo1;
import _17注解解析.Demo;
import com.asin.domain.Person;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class Demo19 {

    public static void main(String[] args) {
        QQLogin qq = new QQLogin();//真实对象

        Login qqLoginProxy =(Login) Proxy.newProxyInstance(Demo19.class.getClassLoader(), new Class[]{Login.class},new InvocationHandler() {
            @Override
            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                System.out.println("执行方法前增强");
                Object invoke = method.invoke(qq);
                System.out.println("执行方法后增强");
                return invoke;
            }
        });


        qqLoginProxy.login();
    }

}
